/*
 Copyright (C) 2009 are of boxtorrents
 boxtorrents, azureus, vuze, and java are copyrighted to their respective owner.

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; version 2 of the License.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 */
package com.boxtorrents.azureus;

import java.io.Serializable;
import java.net.URL;

/**
 * Detail of torrent
 * @author are of boxtorrents.com
 */
public class TorrentData implements Serializable {
	private static final long serialVersionUID = -6585790153628601525L;
	private String name = null;
	private URL url = null;
	private int numSeeder;
	private int numLeecher;
	private String uploaded;
	private String downloaded;
	private String ratio;
	private String size;

	/**
   * @return the size
   */
  public String getSize() {
  	return this.size;
  }

	/**
   * @param size the size to set
   */
  public void setSize(String size) {
  	this.size = size;
  }

	/**
   * @return the downloaded
   */
  public String getDownloaded() {
  	return this.downloaded;
  }

	/**
   * @param downloaded the downloaded to set
   */
  public void setDownloaded(String downloaded) {
  	this.downloaded = downloaded;
  }

	/**
   * @return the name
   */
  public String getName() {
  	return this.name;
  }

	/**
   * @param name the name to set
   */
  public void setName(String name) {
  	this.name = name;
  }

	/**
   * @return the numLeecher
   */
  public int getNumLeecher() {
  	return this.numLeecher;
  }

	/**
   * @param numLeecher the numLeecher to set
   */
  public void setNumLeecher(int numLeecher) {
  	this.numLeecher = numLeecher;
  }

	/**
   * @return the numSeeder
   */
  public int getNumSeeder() {
  	return this.numSeeder;
  }

	/**
   * @param numSeeder the numSeeder to set
   */
  public void setNumSeeder(int numSeeder) {
  	this.numSeeder = numSeeder;
  }

	/**
   * @return the ratio
   */
  public String getRatio() {
  	return this.ratio;
  }

	/**
   * @param ratio the ratio to set
   */
  public void setRatio(String ratio) {
  	this.ratio = ratio;
  }

	/**
   * @return the uploaded
   */
  public String getUploaded() {
  	return this.uploaded;
  }

	/**
   * @param uploaded the uploaded to set
   */
  public void setUploaded(String uploaded) {
  	this.uploaded = uploaded;
  }

	/**
   * @return the url
   */
  public URL getUrl() {
  	return this.url;
  }

	/**
   * @param url the url to set
   */
  public void setUrl(URL url) {
  	this.url = url;
  }

	/**
   * @inheritDoc
   */
  @Override
  public boolean equals(Object obj) {
  	if (obj==null) return false;
  	if (this==obj) return true;
  	if (obj instanceof TorrentData) {
	    TorrentData o = (TorrentData)obj;
	    if (this.getName()==null && o.getName()!=null) return false;
	    if (this.getName()!=null && o.getName()==null) return false;
	    if (this.getName()==null && o.getName()==null) return true;
	    return this.getName().equals(o.getName());
    }
	  return false;
  }
  
  /**
   * @inheritDoc
   */
  @Override
  public int hashCode() {
	  return getName().hashCode() * 11 + 21;
  }
}
